home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 32 / cshownew.zip / VIDEOV1.ASM < prev   
Assembly Source File  |  1989-08-05  |  5KB  |  239 lines

  1. Include Page
  2.     Title    Video 7
  3.  
  4. Include V_Part1.A
  5. Ega_Style    equ        True        ;
  6. Mcga_Style    equ        True        ;
  7.  
  8. ; describe the adapter
  9.         db    7
  10.     ; string 15     '....5....0....5'
  11.         db    'Video 7        '
  12.         db    7        ; number of modes
  13. ; mode 0
  14.         dw    800,600,16    ; screen dimensions, colors
  15.         db    6        ; 6 bit color
  16.         db    Vga+false    ; uses DAC, not simulation
  17.         db    80,60        ; PanH/V
  18. ; mode 1
  19.         dw    1024,768,16
  20.         db    6
  21.         db    Vga+false
  22.         db    100,76
  23. ; mode 2
  24.         dw    320,400,256
  25.         db    6
  26.         db    Vga+TRUE    ; simulation
  27.         db    32,40
  28. ; mode 3
  29.         dw    640,400,256
  30.         db    6
  31.         db    Vga+false
  32.         db    32,20
  33. ; mode 4
  34.         dw    640,480,256
  35.         db    6
  36.         db    Vga+false
  37.         db    32,24
  38. ; mode 5
  39.         dw    640,480,256
  40.         db    6
  41.         db    Vga+TRUE    ; simulation
  42.         db    64,48
  43. ; mode 6
  44.         dw    800,600,256
  45.         db    6
  46.         db    Vga+false
  47.         db    40,30
  48.  
  49. S_Wide label byte
  50.         db    true        ;
  51.         db    true        ;
  52.         db    false        ; double-wide
  53.         db    true        ;
  54.         db    true        ;
  55.         db    true        ;
  56.         db    true        ;
  57.  
  58. ModeSet label byte
  59.         db    62h        ; Video7 SVGA 800x600x16
  60.         db    65h        ; Video7 SVGA 1024x768x16
  61.         db    66h        ; Video7 SVGA 640x400x256
  62.         db    66h        ; Video7 SVGA 640x400x256
  63.         db    67h        ; Video7 SVGA 640x480x256
  64.         db    66h        ; Video7 SVGA 640x400x256
  65.         db    69h        ; Video7 SVGA 800x600x256
  66.  
  67. Include V_Part2.A
  68. Video7Ex    equ        6F05h        ; Video7 extended setmode
  69.  
  70. MoveSimple_
  71.  
  72. CalcAddress_
  73.  
  74. Check64k_
  75.  
  76. SetMode proc near
  77.         mov        al,ModeSet[bx]    ; the extended mode number
  78.         mov        bl,al        ;  to bl
  79.         mov        ax,Video7Ex    ; set Video7 extended
  80.         int        Video        ;  mode
  81.         ret
  82. SetMode endp
  83.  
  84. SetPalette_
  85.  
  86. DisplayRow proc near
  87.         or        al,al        ; zero?
  88.         jz        V0        ;
  89.         dec        al        ; one?
  90.         jz        V1        ;
  91.         dec        al        ; two?
  92.         jz        V2        ;
  93.         dec        al        ; three?
  94.         jz        V3        ;
  95.         dec        al        ; four?
  96.         jz        V4        ;
  97.         dec        al        ; five?
  98.         jz        V5        ;
  99.         jmp short    V6        ; six
  100. V0:        CalcEga        100        ; calc es:di and bank switch
  101.         jmp short    V16        ;
  102. V1:        CalcEga        128        ; calc es:di and bank switch
  103.         jmp short    V16        ;
  104. V2:        DoubleWide            ; mode 2 is a simulation
  105. V3:
  106. V4:        mov        ax,640        ;
  107.         jmp        V256        ;
  108. V5:        SkipOneRowOf    6        ; Simulate 640x480
  109.         mov        ax,640        ;
  110.         jne        V256        ; not row 5, display it
  111.         ret                ; else skip
  112. V6:        mov        ax,800        ;
  113.         jmp short    V256        ;
  114. V16:        WriteEga            ;
  115.         ret
  116. V256:        DisplaySVGA            ;
  117. DisplayRow endp
  118.  
  119. New_BankSet    equ        false
  120.  
  121. ; dx:ax is Video segment:offset, bank switch and set es:di
  122. BankSet proc near
  123. ; set es:di
  124. IF New_BankSet
  125.         mov        di,ax        ;
  126.         mov        ax,GraphicsRAM    ; A000
  127.         mov        es,ax        ; es:di -> A000:address
  128. ; bank switch
  129.         mov        ax,dx        ; bank number
  130.         cmp        al,CurrentBank    ; do we need to switch?
  131.         je        Video7BankOk    ;
  132.         mov        CurrentBank,al    ;
  133.         and        ax,15        ;
  134.         mov        bl,al        ; save bank in BL <--
  135.         mov        dx,3C4h        ; could
  136.         mov        ax,0EA06h    ;  this be
  137.         out        dx,ax        ;   "enable extensions"?
  138.  
  139. ;    Set Bank for 256 color modes
  140. ;
  141. ;    Routine: set_256_bank
  142. ;    Entry: DX = bank to set and DS=CS
  143. ;    Exit: Correct bank set, AX,BX,DX are
  144. ;        destroyed. SC_INDEX has been changed.
  145. ;
  146. ;    Assume: Extensions are enabled. The active page variable has
  147. ;        been properly initialized with a call to this routine
  148. ;        while DX=0.
  149. ;
  150. SC_INDEX    equ    3C4h
  151. ER_PAGE_SEL    equ    0F9h
  152. MISC_INPUT    equ    3CCh
  153. MISC_OUTPUT    equ    3C2h
  154. ER_BANK_SEL    equ    0F6h
  155.  
  156.         mov    dx,SC_INDEX        ;bank bit 0
  157.         mov    ah,bl
  158.         and    ah,1
  159.         mov    al,ER_PAGE_SEL
  160.         out    dx,ax
  161.  
  162.         mov    ah,bl            ;bank bit 1
  163.         and    ah,2
  164.         shl    ah,1
  165.         shl    ah,1
  166.         shl    ah,1
  167.         shl    ah,1
  168.         mov    dx,MISC_INPUT
  169.         in    al,dx
  170.         and    al,not 20h
  171.         mov    dx,MISC_OUTPUT
  172.         or    al,ah
  173.         out    dx,al
  174.  
  175.         mov    dx,SC_INDEX        ;bank bit 2.
  176.         mov    al,ER_BANK_SEL
  177.         out    dx,al            ;get ER_BANK_SEL register
  178.         inc    dx
  179.         in    al,dx
  180.         mov    ah,al
  181. ; duplicate bit 2 into bit 0 (set read and write bank equal)
  182.         shr    bl,1
  183.         shr    bl,1
  184.         add    bl,7
  185.         not    bl
  186.         and    bl,5
  187.         and    ah,0F0h            ;clear bank select bits
  188.         or    ah,bl
  189.         mov    al,ah
  190.         out    dx,al
  191. ELSE
  192.         mov        di,ax        ;
  193.         mov        ax,GraphicsRAM    ; A000
  194.         mov        es,ax        ; es:di -> A000:address
  195. ; bank switch
  196.         mov        ax,dx        ; bank number
  197.         cmp        al,CurrentBank    ; do we need to switch?
  198.         je        Video7BankOk    ;
  199.         mov        CurrentBank,al    ;
  200.         and        ax,15        ;
  201.         mov        ch,al
  202.         mov        dx,3C4h
  203.         mov        ax,0EA06h
  204.         out        dx,ax
  205.         mov        ah,ch
  206.         and        ah,1
  207.         mov        al,0F9h
  208.         out        dx,ax
  209.         mov        al,ch
  210.         and        al,1100b
  211.         mov        ah,al
  212.         shr        ah,1
  213.         shr        ah,1
  214.         or        ah,al
  215.         mov        al,0F6h
  216.         out        dx,al
  217.         inc        dx
  218.         in        al,dx
  219.         dec        dx
  220.         and        al,not 1111b
  221.         or        ah,al
  222.         mov        al,0F6h
  223.         out        dx,ax
  224.         mov        ah,ch
  225.         mov        cl,4
  226.         shl        ah,cl
  227.         and        ah,100000b
  228.         mov        dl,0CCh
  229.         in        al,dx
  230.         mov        dl,0C2h
  231.         and        al,not 100000b
  232.         or        al,ah
  233.         out        dx,al
  234. ENDIF
  235. Video7BankOk:    ret
  236. BankSet endp
  237.  
  238.         end
  239.